<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;

class SendMail extends Mailable
{
    use Queueable, SerializesModels;


    public $email;
    public $content;
    public $view;
    public $title;

    /**
     *
     * @param string $email 邮箱地址
     * @param array $content 传输内容
     * @param string $view 视图名
     * @param string $title 邮件主题
     */
    public function __construct($email = '', $content = [], $view = 'email', $title = 'xin')
    {
        $this->email = $email;
        $this->view = $view;
        $this->title = $title;
        $this->content = $content;
    }

    public function build()
    {
        return $this
            ->view($this->view, $this->content)
            ->subject($this->title)
            ->to($this->email);
    }
}
